home *** CD-ROM | disk | FTP | other *** search
- global bgOffset
-
- on init_ParticleConstants
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_lockParticles, p_LockPic, p_StartSize, p_ScaleRate, p_RotatePic, p_DriftType
- p_StartSprite = 150
- p_MaxParticles = 100
- p_MaxFrames = [3, 3, 3, 4]
- p_FrameDelay = [6, 16, 10, 1]
- p_DriftType = [1, 2, 2, 0]
- p_FrameTitle = ["Bubble", "Bubble", "Bubble", "Laser"]
- p_StartFade = 100
- p_FadeIncrement = 1
- p_InkType = 36
- p_SpawnTimer = 0
- p_RandomFlip = 0
- p_RotatePic = 1
- p_LockPic = 0
- p_StartSize = point(6, 15)
- p_ScaleRate = point(0, 0)
- if p_FrameDelay < 1 then
- p_FrameDelay = 1
- end if
- if p_StartFade < 1 then
- p_StartFade = 1
- end if
- if p_StartFade > 100 then
- p_StartFade = 100
- end if
- p_lockParticles = 1
- end
-
- on init_Particles
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, particleData
- particleData = []
- repeat with wEntry = 1 to p_MaxParticles
- wSprite = p_StartSprite + wEntry - 1
- add(particleData, [0, 0, 0, point(0, 0), point(0, 0), point(0, 0)])
- sprite(wSprite).visible = 0
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to p_FrameTitle[1] & " 1"
- set the ink of sprite wSprite to p_InkType
- set the loc of sprite wSprite to point(0, 0)
- sprite(wSprite).locZ = 11
- end repeat
- end
-
- on addparticle spawnPoint, SpawnRotate, spawnType
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_RotatePic, particleData, p_lockParticles, p_DriftType
- if p_lockParticles = 1 then
- validSlot = 0
- repeat with wSlot = 1 to p_MaxParticles
- if (validSlot = 0) and (particleData[wSlot][1] = 0) then
- validSlot = wSlot
- end if
- end repeat
- if validSlot <> 0 then
- case spawnType of
- 1:
- mAim = random(360)
- rPow = 5 + random(5)
- locY = cos(mAim * PI / 180) * -rPow
- locX = sin(mAim * PI / 180) * rPow
- 2:
- if SpawnRotate = VOID then
- SpawnRotate = random(360)
- end if
- rPow = random(100)
- locY = cos(SpawnRotate * PI / 180) * -rPow
- locX = sin(SpawnRotate * PI / 180) * rPow
- 3:
- if SpawnRotate = VOID then
- SpawnRotate = random(180) - 90
- end if
- rPow = random(50)
- locY = cos(SpawnRotate * PI / 180) * -rPow
- locX = sin(SpawnRotate * PI / 180) * rPow
- end case
- particleData[validSlot] = [spawnType, 0, 0, spawnPoint, point(locX, locY), point(0, 0)]
- wSprite = p_StartSprite + validSlot - 1
- set the loc of sprite wSprite to spawnPoint + bgOffset
- set the member of sprite wSprite to p_FrameTitle[spawnType] & " 1"
- set the blend of sprite wSprite to p_StartFade
- sprite(wSprite).rotation = SpawnRotate
- sprite(wSprite).visible = 1
- end if
- end if
- end
-
- on moveParticles
- global p_StartSprite, p_MaxParticles, p_MaxFrames, p_FrameDelay, p_FrameTitle, p_StartFade, p_FadeIncrement, p_InkType, p_SpawnTimer, p_LockPic, p_StartSize, p_ScaleRate, particleData, playerViewPoint, p_DriftType
- p_SpawnTimer = p_SpawnTimer + 1
- if p_SpawnTimer > 36500 then
- p_SpawnTimer = 1
- end if
- repeat with wEntry = 1 to p_MaxParticles
- wSprite = p_StartSprite + wEntry - 1
- if particleData[wEntry][1] <> 0 then
- eType = particleData[wEntry][1]
- if particleData[wEntry][3] <= 1 then
- particleData[wEntry][3] = p_FrameDelay[eType]
- particleData[wEntry][2] = particleData[wEntry][2] + 1
- if particleData[wEntry][2] > p_MaxFrames[eType] then
- particleData[wEntry][1] = 0
- sprite(wSprite).visible = 0
- else
- if p_LockPic = 0 then
- set the member of sprite wSprite to p_FrameTitle[eType] & " " & string(particleData[wEntry][2])
- else
- set the blend of sprite wSprite to p_StartFade + (p_FadeIncrement * particleData[wEntry][2])
- end if
- end if
- else
- case p_DriftType[eType] of
- 1:
- if particleData[wEntry][5][1] > 0 then
- particleData[wEntry][6][1] = particleData[wEntry][6][1] - 1
- else
- particleData[wEntry][6][1] = particleData[wEntry][6][1] + 1
- end if
- if particleData[wEntry][5][2] < 10 then
- particleData[wEntry][5][2] = particleData[wEntry][5][2] - 1
- end if
- if particleData[wEntry][4][2] > 3700 then
- particleData[wEntry][4][2] = 3700
- end if
- 2:
- particleData[wEntry][5][2] = particleData[wEntry][5][2] - 2
- if particleData[wEntry][4][2] > 3700 then
- particleData[wEntry][4][2] = 3700
- end if
- end case
- particleData[wEntry][5] = particleData[wEntry][5] + particleData[wEntry][6]
- particleData[wEntry][4] = particleData[wEntry][4] + particleData[wEntry][5]
- particleData[wEntry][3] = particleData[wEntry][3] - 1
- end if
- set the loc of sprite wSprite to (particleData[wEntry][4] - playerViewPoint) / 10
- next repeat
- end if
- end repeat
- end
-